﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once
#include "GcmpUiCommandAction.h"
#include "ActionBase.h"

namespace gcmp
{
    class IRibbonGroup;
    class IRibbonContextualPage;
   
    /// \brief 操作（Action）实现基类，用于派生实现自定义Action。
    class GCMP_UI_COMMAND_ACTION_EXPORT GcmpActionBase : public gcmp::ActionBase
    {
    public:
        GcmpActionBase();
        virtual ~GcmpActionBase();

    public:
        /// 添加多个Group到指定的RibbonPage中
        ///
        ///  并将该Page设置为当前page, 且设置为上下文风格， 
        ///
        /// \param  pageId RibbonPage的Id, 唯一标识
        /// \param  groups 待添加的Group对象
        /// \param  contextualPageCaption RibbonPage上下文标题
        /// \return void
        void AddDynamicGroup(const std::wstring& pageId, std::vector<gcmp::OwnerPtr<gcmp::IRibbonGroup> >&& dynamicGroups, const std::wstring& contextualPageCaption = L"");

    protected:
        /// \brief  退出Action时，是否要恢复到进入之前的Ribbon页面
        virtual bool ShouldRestoreRibbonPage();

    private:
        OwnerPtr<IRibbonContextualPage>   m_pRibbonContextualPage;
    };

}

